
public class Test {
    //交换值
    public  static  void swap(int x,int y){
        int tmp = x;
        x = y;
        y =tmp;
    }

    public static void main(String[] args) {
        int a =1;
        int b =2;
        System.out.println("交换之前："+a);
        System.out.println("交换之前："+b);
        swap(a,b);
        System.out.println("交换之后"+a);
        System.out.println("交换之后"+b);
    }
    public static int sum (int x ,int y){
        return x+y;
    }

    public static void main5(String[] args) {
        int a =1 ;
        int b =2;
        int ret= sum(a,b);
        System.out.println(ret);
    }

    public static int sum(int n){
        return ((n+1)*n)/2;
    }
    public static void main4(String[] args) {
        int ret = sum(10); // 10为实参，方法调用时，形参n用来保存10
        System.out.println(ret);
    }



    //计算n！
    public static int facSum(int n){
        int ret =1;
        for (int j = 1; j <=n ; j++) {
            ret *= j;
        }
        return ret;
    }


    public static void main3(String[] args) {
        //计算n！之积
        int Dev =0;
        for (int i = 1; i <=5 ; i++) {
            Dev *=facSum(i);
        }
        System.out.println(Dev);

    }
    public static void main2(String[] args) {
        //计算 1! + 2! + 3! + 4! + 5!
        int sum = 0;
        for (int i =1 ; i <=5 ; i++) {
            //sum+=ret;
        }
        System.out.println(sum);
    }
}
